package org.halk.task;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author halk
 * @Date 2023/7/20 15:00
 */

@Component
//@ConditionalOnProperty(prefix = "halk.task", name = "enable", havingValue = "true")
@ConditionalOnProperty(name = "halk.task.enable", havingValue = "true")
public class MyTask {

    //    @Scheduled(cron = "* * * * * ?")
    @Scheduled(fixedDelay = 1000, initialDelay = 2000)
    public void testSchedule() {
        System.out.println("定时任务执行了。。。。" + Thread.currentThread().getName());
    }
}
